//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.ares.app.demo.common.cfg;

import java.nio.charset.Charset;
import java.util.ArrayList;
import javax.servlet.Filter;
import org.ares.app.demo.common.mvc.filter.DemoFilter;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;

@Configuration
public class DemoBeanCfg {
    public DemoBeanCfg() {
    }

    @Bean
    public RestTemplate restTemplate() {
        SimpleClientHttpRequestFactory var1 = new SimpleClientHttpRequestFactory();
        var1.setReadTimeout(3000);
        var1.setConnectTimeout(3000);
        RestTemplate var2 = new RestTemplate(var1);
        ArrayList var3 = new ArrayList();
        var3.add(MediaType.TEXT_HTML);
        var3.add(MediaType.APPLICATION_JSON_UTF8);
        ArrayList var4 = new ArrayList();
        StringHttpMessageConverter var5 = new StringHttpMessageConverter(Charset.forName("UTF-8"));
        var5.setSupportedMediaTypes(var3);
        var4.add(var5);
        MappingJackson2HttpMessageConverter var6 = new MappingJackson2HttpMessageConverter();
        var6.setSupportedMediaTypes(var3);
        var4.add(var6);
        var2.setMessageConverters(var4);
        var2.setRequestFactory(var1);
        return var2;
    }

    @Bean
    public StringEncryptor encryptor() {
        StandardPBEStringEncryptor var1 = new StandardPBEStringEncryptor();
        EnvironmentStringPBEConfig var2 = new EnvironmentStringPBEConfig();
        var2.setAlgorithm("PBEWithMD5AndDES");
        var2.setPassword("ares@2017");
        var1.setConfig(var2);
        var2.setStringOutputType("base64");
        return var1;
    }

    @Bean
    public Filter demoFilter() {
        return new DemoFilter();
    }
}
